package com.Ajava1704.for设计模式.for动态代理.jdk动态代理;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @类名: com.Ajava1704.for设计模式.for动态代理.jdk动态代理
 * @作者: lgt
 * @创建时间: 2020-02-14 21:13
 * @描述:
 **/
public class ForMyInvovationHandler2<T> implements InvocationHandler {

    private T t;

    public ForMyInvovationHandler2(T t) {
        this.t = t;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("-----向数据库写日志------");
        Object invoke = method.invoke(t, args);
        System.out.println("======向Rabbitmq发一条消息=====");
        return invoke;
    }
}
